package com.hd.assistant.dal.dataobject;

import java.io.Serializable;
import java.util.Date;

import com.alibaba.fastjson.JSONObject;
import com.hd.util.CommonUtil;
import com.taobao.api.domain.UserCredit;

public class User implements Serializable{

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	public static String Type_PAIPAI = "1";
	public static String Type_TAOBAO = "2";
	public static String Type_TAOBAO_ORDER = "3";
	public static String Type_PAIPAI_ORDER = "4";
	public static String Type_TAOBAO_SHARE = "5";
	public static String Type_PAIPAI_SXJ = "6";
	private Long id;
	private Long userId;

	private String userNick;
	private Date gmtModified;
	private Date gmtCreated;
	/**
	 * 用户类型 1拍拍 2淘宝
	 */
	private String userType;
	
	/**
	 * 产品版本
	 */
	private String version; 
	
	/**
	 * 过期时间
	 */
	private Date expireDate;
	
	private String email;
	
	private String phone;
	private String token;
	
	private String rtoken;
	
	private Date itemcostLastUpdate;
	
	private Date orderLastUpdate;
	
	private String type;
	
	private Double creditCardRate;
	
	private Double tmallRate;
	
	private String creditInfo;
	
	private UserCredit userCredit;
	
	private String currentToken;
	
	private String currentOAuthId;
	
	private Date lastLogin;
	
	
	public String getType() {
		return type;
	}

	public void setType(String type) {
		this.type = type;
	}

	public Double getCreditCardRate() {
		return creditCardRate;
	}

	public void setCreditCardRate(Double creditCardRate) {
		this.creditCardRate = creditCardRate;
	}

	public Double getTmallRate() {
		return tmallRate;
	}

	public void setTmallRate(Double tmallRate) {
		this.tmallRate = tmallRate;
	}

	public UserCredit getUserCredit() {
		return userCredit;
	}

	public void setUserCredit(UserCredit userCredit) {
		this.userCredit = userCredit;
		if(userCredit != null)
			this.creditInfo = JSONObject.toJSONString(userCredit);
	}

	public String getCreditInfo() {
		return creditInfo;
	}

	public void setCreditInfo(String creditInfo) {
		this.creditInfo = creditInfo;
		
		try{
			if(this.userCredit == null)
				this.userCredit = JSONObject.parseObject(creditInfo, UserCredit.class);
			}catch(Exception e){
		}
	}

	public String getToken() {
		return token;
	}

	public void setToken(String token) {
		this.token = token;
		this.currentToken = token;
	}

	public String getRtoken() {
		return rtoken;
	}

	public void setRtoken(String rtoken) {
		this.rtoken = rtoken;
	}

	public Date getLastLogin() {
		return lastLogin;
	}

	public void setLastLogin(Date lastLogin) {
		this.lastLogin = lastLogin;
	}

	public String getCurrentOAuthId() {
		return currentOAuthId;
	}

	public void setCurrentOAuthId(String currentOAuthId) {
		this.currentOAuthId = currentOAuthId;
	}

	

	public Long getUserId() {
		return userId;
	}

	public void setUserId(Long userId) {
		this.userId = userId;
	}

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public String getUserNick() {
		return userNick;
	}

	public void setUserNick(String userNick) {
		this.userNick = userNick;
	}

	public String getUserType() {
		return userType;
	}

	public void setUserType(String userType) {
		this.userType = userType;
	}

	public String getVersion() {
		return version;
	}

	public void setVersion(String version) {
		this.version = version;
	}

	public Date getExpireDate() {
		return expireDate;
	}

	public void setExpireDate(Date expireDate) {
		this.expireDate = expireDate;
	}

	public String getEmail() {
		return email;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	public String getPhone() {
		return phone;
	}

	public void setPhone(String phone) {
		this.phone = phone;
	}

	public String getCurrentToken() {
		return currentToken;
	}

	public void setCurrentToken(String currentToken) {
		this.currentToken = currentToken;
		this.token = currentToken;
	}

	public Date getGmtModified() {
		return gmtModified;
	}

	public void setGmtModified(Date gmtModified) {
		this.gmtModified = gmtModified;
	}

	public Date getGmtCreated() {
		return gmtCreated;
	}

	public void setGmtCreated(Date gmtCreated) {
		this.gmtCreated = gmtCreated;
	}

	public Date getItemcostLastUpdate() {
		return itemcostLastUpdate;
	}

	public void setItemcostLastUpdate(Date itemcostLastUpdate) {
		this.itemcostLastUpdate = itemcostLastUpdate;
	}

	public Date getOrderLastUpdate() {
		return orderLastUpdate;
	}

	public void setOrderLastUpdate(Date orderLastUpdate) {
		this.orderLastUpdate = orderLastUpdate;
	}

	public String getItemcostLastUpdateDisplay(){
		if(itemcostLastUpdate == null)
			return null;
		return CommonUtil.formatDate("yyyy-MM-dd hh:mm:ss", this.itemcostLastUpdate);
	}
	
	
}
